package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.AttackDetectionAttrHandler;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.DomainNameAttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @version V1.0
 * @author:lxb
 * @Package
 * @date:2021/4/15
 */
@Service
@AttrHandler(DomainNameAttrHandler.class)
public class DomainNameAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {
    @Override
    public void handle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {
        KiteAttr attr21=kiteInst.getAttr("2_0000221");
        KiteAttr attr23=kiteInst.getAttr("200002823");

        KiteAttr attr36=kiteInst.getAttr("200002836");//使用联通AAA客户终端IP地址类型
        KiteAttr attr37=kiteInst.getAttr("200002837");//企业AAA中心端IP（LNS IP）

        if(KiteStringUtils.equals(kiteAttr.getValue(),"100004678")){
            attr23.setValue(attr21.getValueDesc());
            attr23.setValueDesc(attr21.getValueDesc());
            attr23.setIsEdit("F");
        }if(KiteStringUtils.equals(kiteAttr.getValue(),"100004679")){
            attr23.setValue("山东全省");
            attr23.setValueDesc("山东全省");
            attr23.setIsEdit("F");
        }
        if(KiteStringUtils.equalsAny(kiteAttr.getValue(),"100004687","100004691")){
            attr36.setIsNull("F");
        }else {
            attr36.setIsNull("T");
        }
        if(KiteStringUtils.equalsAny(kiteAttr.getValue(),"100004688","100004692")){
            attr37.setIsNull("F");
        }else{
            attr37.setIsNull("T");
        }
      /*  operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr36);
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr23);
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr37);*/


    }

    @Override
    public void handleStyle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {

    }
}
